define(function(require, exports){
	var pubjs = require('pubjs');
	var highGrid = require('@base/highGrid');
	var baseGrid = require('@base/grid');

	// 人群标签表格
	var Grid = highGrid.base.extend({
		init: function( config ) {
			config = pubjs.conf( config, {
				'key': 'VisitorCateId',
				"cols" : [
					{ type: 'id', width: 50 },
					{ name : "Name", text : LANG("人群标签"), align : "left", render: 'renderName' ,width:600},
					{ name : "Visitors", text : LANG("人数"), align : "center" ,width:150, sort: true}
				],
				'metrics': [

				],
				'isSendMetrics': false,
				'reqType': 'websocket',
				'url': 'PDMP/listTag',
				'hasBatch': false,
				"hasExport" : true,
				"hasTab" : false,
				'hasSwitch': false,
				'hasAmount': false,
				'hasMenu': true,
				'hasRefresh': true,
				'gridName': 'PDMPList'
			});
			this.Super( "init", arguments );
		},
		renderName: function( i, val, data ) {
			var cls = data['IsDeleted'] ? 'pause' : 'running';
			var title = data['IsDeleted'] ? LANG('暂停') : LANG('开启');
			return '<i class="'+ cls +'" title="'+ title +'"></i>' + LANG(val);
		}
	});
	exports.base = Grid;

	// 查看活动列表 表格
	var CampaignList = baseGrid.baseNoDate.extend({
		init : function( config ) {
			config = pubjs.conf( config, {
				"cols" : [
					{ name : "_id", text : LANG("ID"), align : "center" },
					{ name : "Name", text : LANG("活动名称"), align : "left" }
				],
				'url': 'PDMP/getRelCampaign',
				'reqType': 'websocket',
				'default_sort': false,
				"hasExport" : false,
				"hasAmount" : false,
				"hasTab" : false,
				'hasPager': true,
				'hasSelect': false,
				'hasSearch': true,
				'sub_field': 'Id',
				'list': {
					'scroll_type': 'row',
					'scroll_size': 3
				},
				'pager':{
					"size": 10,
					"bounds":5,
					"firstLast":false,
					"showJumper":0,
					"showSizeTypes":0
				}
			});
			this.Super( "init", arguments );
		}
	});
	exports.campaignList = CampaignList;
	
	
	var BdxPeople = highGrid.base.extend({
		init: function( config ) {
			config = pubjs.conf( config, {
				'key': 'VisitorCateId',
				"cols" : [
					{ type: 'id', width: 50 },
					{ name : "Name", text : LANG("人群标签"), align : "left" ,width:600},
					{ name : "Visitors", text : LANG("人数"), align : "center" ,width:150, sort: true}
				],
				'isSendMetrics': false,
				'reqType': 'websocket',
				'url': 'PDMP/bdxPeople',
				'hasBatch': false,
				"hasExport" : true,
				"hasTab" : false,
				'hasSwitch': false,
				'hasAmount': false,
				'hasMenu': false,
				'hasRefresh': true,
				'hasFilter': false,
				'param': {
					'ChannelId': 168,
					'isMobile': 0,
					'isGrid': true
				},
				'gridName': 'BdxPeopleList'
			});
			this.Super( "init", arguments );
		}
	});
	exports.bdxPeople = BdxPeople;
	
	var BaiduPeople = highGrid.base.extend({
		init: function( config ) {
			config = pubjs.conf( config, {
				'key': 'VisitorCateId',
				"cols" : [
					{ type: 'id', width: 50 },
					{ name : "TotalName", text : LANG("人群标签"), align : "left" ,width:600},
					{ name : "Total", text : LANG("人数"), align : "center", width:150, "format": "numberFormat", "sort": true}
				],
				'isSendMetrics': false,
				'reqType': 'websocket',
				'url': 'category/listPeople',				
				'hasBatch': false,
				"hasExport" : true,
				"hasTab" : false,
				'hasSwitch': false,
				'hasAmount': false,
				'hasMenu': true,
				'hasRefresh': true,
				'hasFilter': false,
				'hasMenu': false,
				'param': {
					'ChannelId': 10009
				},
				'gridName': 'peopleList'
			});
			this.Super( "init", arguments );
		}
	});
	exports.baiduPeople = BaiduPeople;
	
	var TaobaoPeople = BaiduPeople.extend({
		init: function( config ) {
			config = pubjs.conf( config, {
				'param': {
					'ChannelId': 10004
				}
			});
			this.Super( "init", arguments );
		}
	});
	exports.taobaoPeople = TaobaoPeople;
});